package com.ydlclass;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author duWenJian
 * @Date 2024/3/7 15:14
 * @Version 1.0
 */
@Component
@Slf4j
public class YrpcStarter implements CommandLineRunner{
    @Override
    public void run(String... args) throws Exception {
        Thread.sleep(3000);
        log.info("provider开始启动");
        YrpcBootstrap.getInstance()
                // 应用名称
                .application("first-yrpc-provider")
                // 服务注册中心
                .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
                .serialize("jdk")
                // spring里面的扫描
                .scan("com.ydlclass.impl")
                // 启动服务
                .start();
    }
}
